package com.fcl.oschina.adapter;

import android.content.Context;

import com.fcl.mylibrary.recyclerviewhelper.BaseAdapter;
import com.fcl.mylibrary.recyclerviewhelper.BaseHolder;
import com.fcl.mylibrary.util.StringUtil;
import com.fcl.oschina.R;
import com.fcl.oschina.entity.NewItem;

import java.util.List;

/**
 * Created by Administrator on 2017/3/20.
 */

public class NewsAdapter extends BaseAdapter<NewItem> {
    public NewsAdapter(Context context, int layoutId, List<NewItem> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void bindHolder(BaseHolder baseHolder, NewItem data) {
        super.bindHolder(baseHolder, data);
        baseHolder.setText(R.id.title, data.getTitle());
        baseHolder.setText(R.id.content, data.getBody());
        baseHolder.setText(R.id.comment, data.getCommentCount()+"");
        baseHolder.setText(R.id.date, StringUtil.formatSomeAgo(data.getPubDate()));
    }
}
